// ==UserScript==
// @name       巨量百应客服COZE_AI
// @namespace  npm/vite-plugin-monkey
// @version    0.0.0
// @author     xuanxiaoqian
// @icon       https://lf1-fe.ecombdstatic.com/obj/eden-cn/upelogps/bitbug_favicon.ico
// @match      https://buyin.jinritemai.com/**
// @require    //unpkg.com/element-plus/dist/index.css
// @require    https://cdn.jsdelivr.net/npm/vue@3.5.14/dist/vue.global.prod.js
// @require    data:application/javascript,%3Bwindow.Vue%3DVue%3B
// @require    https://cdn.jsdelivr.net/npm/element-plus@2.9.11/dist/index.full.min.js
// @grant      GM_addStyle
// @grant      GM_xmlhttpRequest
// @connect      *
// ==/UserScript==

(function () {
  const CODE_TITLE = ' 你的远程模块 ';
  let REMOTE_URL = 'https://gitee.com/xuanxiaoqian/unicorn-tool-warehouse/raw/master/%E6%BA%90%E6%96%87%E4%BB%B6/%E6%B5%8F%E8%A7%88%E5%99%A8%E8%84%9A%E6%9C%AC/xuanxiaoqian.user.js';

  let REMOTE_URL_local = localStorage.getItem('REMOTE_URL_local');
  if (REMOTE_URL_local) {
    console.log(REMOTE_URL_local);

    REMOTE_URL = REMOTE_URL_local;
  }

  GM_xmlhttpRequest({
    method: 'GET',
    url: REMOTE_URL,
    onload: (response) => {
      const res = response.responseText;
      eval(res);
    },
    onerror: (error) => {
      console.log(error);

      let userInput = prompt("原网址失效,输入新的网址", REMOTE_URL);

      if (userInput !== null) {
        localStorage.setItem('REMOTE_URL_local', userInput);

        console.log("用户输入:", userInput);
      }
    }
  });

  console.log(CODE_TITLE);
})();
